package org.hu.config;

import org.hu.Filter.JwtFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<JwtFilter> jwtFilter() {
        FilterRegistrationBean<JwtFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new JwtFilter());

        // 设置要拦截的路径（支持通配符）
        registrationBean.addUrlPatterns("/*");

        // 设置顺序（数字越小，优先级越高）
        registrationBean.setOrder(1);

        return registrationBean;
    }
}

